Skip to main content

file_splitter

1. Description

This program processes .cf and .txt input files, transforming and organizing their data according to specified rules and metadata. It can split the output by identifiers or merge all data into a single file, depending on configuration settings.

2. Input

2.1 Mandatory Parameters

#ParametersDescriptionExample
1process_configPath to the process configuration file that needs to be processed/path/to/process_config.json
2as_on_dateThe date for which the program should run2024-11-28
3log_file_pathPath to write general processing logstest-bed/log.txt
4diagnostics_file_pathPath to write diagnostics logs for performance and error trackingtest-bed/diag_log.txt
5is_split_reqFlag to decide if output needs to be split based on LLGtrue

2.2 Non-Mandatory Parameters

#ParametersDescriptionDefault ValueExample
1log_levelLevel of diagnostics written to the log fileinfoerror/warn/info/debug/trace/none
2is_perf_diagnostics_enabledFlag to decide if performance diagnostics will be loggedfalsetrue or false
3is_split_reqFlag to decide if output needs to be split based on LLGtruetrue or false
4default_llg_codeDefault LLG (Local Legal Group) code used for processing088881000

2.3 process-config


{
"id": "M_PC004",
"name": "RULE_BASED_SPLITTER_CONFIG",
"file_type": "ProcessConfig",
"base_input_id": "M_IN011",
"base_input_metadata": "path/to/input_details.json",
"base_output_id": "M_OP011",
"base_output_metadata": "path/to/output_details.json",
"additional_output": [
{
"id": "M_OP012",
"output_metadata_path": "path/to/addnl_details_1.json"
},
{
" id": "M_OP013",
"output_metadata_path": "path/to/addnl_details_2.json"
}
]
}

3. Output

File naming is done based on the name present in metadata file like this: Rule-Based-Splitter-{name}.txt . Also Rule-Based-Splitter-merged.txt is also created.

3.1 is_split_req=true

If is_split_req is true, the input.txt file is read and each line is iterated one by one. Each line is added to different files according to the extracted llg_code from rules given in metadata files.If any llg_code is not present in metadata, then NA.txt is created and that line is added in this file. If it is a .cf file, it extracts the data for each account and its cashflows.Format the data as a string, separated by a delimiter and appending to the files is done in the same way as .txt file

Ex:


AC001|USD|10.467|4000.237|24-10-2023
AC001|USD|14.467|4004.237|26-10-2023
AC001|USD|15.467|4005.237|27-10-2023
AC001|USD|17.467|4007.237|29-10-2023

3.2 is_split_req=false

If is_split_req is false, the input.txt file is read and lines are iterated one by one. At the end of each line the llg_code is added with a "|" separator and the line is added into the merged file. If it is a .cf file, it extracts the data for each account and its cashflows.Format the data as a string, separated by a delimiter and appending to the files is done in the same way as .txt file

Ex:


AC001|USD|10.467|4000.237|24-10-2023|1000
AC001|INR|11.467|4001.237|22-10-2023|2000
AC001|YEN|12.467|4002.237|23-10-2023|3000
AC001|INR|13.467|4003.237|25-10-2023|2000
AC001|USD|14.467|4004.237|26-10-2023|1000
AC001|USD|15.467|4005.237|27-10-2023|1000
AC001|YEN|16.467|4006.237|28-10-2023|3000
AC001|USD|17.467|4007.237|29-10-2023|1000
AC001|INR|18.467|4008.237|30-10-2023|2000
AC001|INR|19.467|4009.237|01-10-2023|2000
AC001|YEN|20.467|4010.237|02-10-2023|3000